<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="X-UA-Compatible" content="IE=edge"/>
    <title>（//▽//）</title>
    <meta content='width=device-width, initial-scale=1.0, shrink-to-fit=no' name='viewport'/>
    <link rel="icon" href="../assets/img/icon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="../static/css/ladda-themeless.min.css">
    <link href="../static/css/bootstrap-datetimepicker.css" rel="stylesheet"/>
    <script src="../static/assets/jquery.min.js"></script>
    <!-- Fonts and icons -->
    <script src="../assets/js/plugin/webfont/webfont.min.js"></script>
    <script src="../static/js/ajaxlink.js"></script>
    <script src="../static/js/jquerysession.js"></script>
    <script type="text/javascript">
        var username = "";
        var id = "";
        var pwd_status = "";

        function getUser() {
            $.ajax({
                url: "/get_session",
                //url: "http://" + window.location.host + "/SecondDemo/user/getSession",
                type: "GET",
                async: false,
                success: function (data) {
                    console.log(data);
                    if (data === "new") {
                        console.log("not login");
                        window.location.href = "/login";
                        return false;
                    }
                    var jsonobj = JSON.parse(data);
                    console.log(jsonobj);
                    id = jsonobj.stu_id;
                    username = jsonobj.username;
                    if (username === "undefined") {
                        console.log("not login");
                        window.location.href = "/login";
                        return false;
                    }
                    pwd_status = jsonobj.password;
                },
                error: function (e) {
                    alert("出错");
                    alert(e.responseText);
                },
            });
        }

        $(document).ready(function () {
            getUser();
            if (typeof (username) === "undefined" || username === "") {
                console.log("not login");
                window.location.href = "/login";
                return false;
            } else {
                //$.session.set('stu_id', id);
                window.sessionStorage.setItem('stu_id', id);
                $('#current-user').prepend("欢迎, " + username);
                document.getElementById('current-id').innerHTML += id;
                //document.getElementById('avatar0').innerHTML += username[0];
                document.getElementById('avatar1').innerHTML += username[0];
            }
            if (pwd_status === "no_pwd") {
                notify("warning", "你未设置密码，点击进入设置", "系统", 0, 'javascript:conf_password();');
            }
        });
    </script>
    <script>
        function conf_password() {
            LoadAjaxContent("conf");
        }

        function notify(state, message, title, delay, url) {
            var placementFrom = "bottom";
            var placementAlign = "right";
            var state = state;
            var style = "withicon";
            var content = {};

            content.message = message;
            content.title = title;
            if (style == "withicon") {
                content.icon = 'fa fa-bell';
            } else {
                content.icon = 'none';
            }
            content.url = url;
            content.target = '_self';

            $.notify(content, {
                type: state,
                placement: {
                    from: placementFrom,
                    align: placementAlign
                },
                time: 1000,
                delay: delay,
            });
        }
    </script>
    <script>
        WebFont.load({
            google: {"families": ["Open+Sans:300,400,600,700"]},
            custom: {
                "families": ["Flaticon", "Font Awesome 5 Solid", "Font Awesome 5 Regular", "Font Awesome 5 Brands"],
                urls: ['../assets/css/fonts.css']
            },
            active: function () {
                sessionStorage.fonts = true;
            }
        });
    </script>

    <!-- CSS Files -->
    <link rel="stylesheet" href="../assets/css/bootstrap.min.css">
    <link rel="stylesheet" href="../assets/css/azzara.min.css">

    <!-- CSS Just for demo purpose, don't include it in your project -->
    <link rel="stylesheet" href="../assets/css/demo.css">
</head>
<body>
<div class="wrapper">
    <!--
            Tip 1: You can change the background color of the main header using: data-background-color="blue | purple | light-blue | green | orange | red"
    -->
    <div class="main-header" data-background-color="purple">
        <!-- Logo Header -->
        <div class="logo-header">

            <a href="index" class="logo">
                <img src="../static/imgs/logo.svg" alt="navbar brand" class="navbar-brand">
            </a>
            <button class="navbar-toggler sidenav-toggler ml-auto" type="button" data-toggle="collapse"
                    data-target="collapse" aria-expanded="false" aria-label="Toggle navigation">
					<span class="navbar-toggler-icon">
						<i class="fa fa-bars"></i>
					</span>
            </button>
            <button class="topbar-toggler more"><i class="fa fa-ellipsis-v"></i></button>
            <div class="navbar-minimize">
                <button class="btn btn-minimize btn-rounded">
                    <i class="fa fa-bars"></i>
                </button>
            </div>
        </div>
        <!-- End Logo Header -->

        <!-- Navbar Header -->
        <nav class="navbar navbar-header navbar-expand-lg">

            <div class="container-fluid">
                <ul class="navbar-nav topbar-nav ml-md-auto align-items-center">
                    <li class="nav-item dropdown hidden-caret">
                        <a class="nav-link dropdown-toggle" href="#" id="messageDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i class="fa fa-envelope"></i>
                        </a>
                        <ul class="dropdown-menu messages-notif-box animated fadeIn" aria-labelledby="messageDropdown">
                            <li>
                                <div class="dropdown-title d-flex justify-content-between align-items-center">
                                    Messages
                                    <a href="#" class="small">Mark all as read</a>
                                </div>
                            </li>
                            <li>
                                <div class="message-notif-scroll scrollbar-outer">
                                    <div class="notif-center">
                                        <!-- ... -->
                                    </div>
                                </div>
                            </li>
                            <li>
                                <a class="see-all" href="javascript:void(0);">See all messages<i
                                        class="fa fa-angle-right"></i> </a>
                            </li>
                        </ul>
                    </li>
                    <li class="nav-item dropdown hidden-caret">
                        <a class="nav-link dropdown-toggle" href="#" id="notifDropdown" role="button"
                           data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                            <i class="fa fa-bell"></i>
                            <!--<span class="notification">4</span>-->
                        </a>
                        <ul class="dropdown-menu notif-box animated fadeIn" aria-labelledby="notifDropdown">
                            <li>
                                <div class="dropdown-title">You have 4 new notification</div>
                            </li>
                            <li>
                                <div class="notif-center">
                                    <!-- ... -->
                                </div>
                            </li>
                            <li>
                                <a class="see-all" href="javascript:void(0);">See all notifications<i
                                        class="fa fa-angle-right"></i> </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </div>
        </nav>
        <!-- End Navbar -->
    </div>

    <!-- Sidebar -->
    <div class="sidebar">

        <div class="sidebar-background"></div>
        <div class="sidebar-wrapper scrollbar-inner">
            <div class="sidebar-content">
                <div class="user">
                    <div class="avatar-sm float-left mr-2">
                        <span id="avatar1"
                              class="avatar-title rounded-circle border border-white"></span>
                    </div>
                    <div class="info">
                        <a data-toggle="collapse" href="#collapseExample" aria-expanded="true">
								<span id="current-user">
									<span id="current-id" class="user-level"></span>
									<span class="caret"></span>
								</span>
                        </a>
                        <div class="clearfix"></div>

                        <div class="collapse in" id="collapseExample">
                            <ul class="nav main-menu">
                                <li>
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item ajax-link" href="profile">个人信息</a>
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item ajax-link" href="conf">账户设定</a>
                                    <div class="dropdown-divider"></div>
                                    <a class="dropdown-item" href="/logout"><i class="fas fa-sign-out-alt"></i>&nbsp;&nbsp;Logout</a>
                                </li>
                            </ul>
                        </div>
                    </div>

                </div>
                <ul class="nav main-menu">
                    <li class="nav-item active">
                        <a href="/index">
                            <i class="fas fa-home"></i>
                            <p>主界面</p>
                        </a>
                    </li>
                    <li class="nav-section">
							<span class="sidebar-mini-icon">
								<i class="fa fa-ellipsis-h"></i>
							</span>
                        <h4 class="text-section">！！！ Σ(っ °Д °;)っ</h4>
                    </li>
                    <li class="nav-item">
                        <a class="ajax-link" href="/bus/work_list">
                            <i class="fas fa-layer-group"></i>
                            <p>作业清单</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="ajax-link" href="/bus/upload_history">
                            <i class="fas fa-history"></i>
                            <p>提交历史</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="ajax-link" href="upload_history">
                            <i class="far fa-comment-alt"></i>
                            <p>站内公告</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a class="ajax-link" href="upload_history">
                            <i class="fas fa-cloud-download-alt"></i>
                            <p>资源下载</p>
                        </a>
                    </li>
                    <li class="nav-item">
                        <a data-toggle="collapse" href="#tables">
                            <i class="fas fa-table"></i>
                            <p>信息发布</p>
                            <span class="caret"></span>
                        </a>
                        <div class="collapse" id="tables">
                            <ul class="nav nav-collapse">
                                <li>
                                    <a href="tables/tables.html">
                                        <span class="sub-item">发布公告</span>
                                    </a>
                                </li>
                                <li>
                                    <a href="tables/datatables.html">
                                        <span class="sub-item">上传资料</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                    <li class="nav-item">
                        <a data-toggle="collapse" href="#settings">

                            <i class="fas fa-cogs"></i>
                            <p>管理选项</p>
                            <span class="caret"></span>
                        </a>
                        <div class="collapse" id="settings">
                            <ul class="nav nav-collapse">
                                <li>
                                    <a class="ajax-link" href="sys_conf">
                                        <i class="fas fa-cog"></i>
                                        <span class="sub-item">系统管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a class="ajax-link" href="/sys/work_list">
                                        <i class="far fa-list-alt"></i>
                                        <span class="sub-item">作业管理</span>
                                    </a>
                                </li>
                                <li>
                                    <a class="ajax-link" href="/sys/stu_list">
                                        <i class="fas fa-users-cog"></i>
                                        <span class="sub-item">学生管理</span>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </li>
                </ul>
            </div>
        </div>
    </div>
    <!-- End Sidebar -->

    <div class="main-panel">
        <div class="content">
            <div class="page-inner">
                <div class="preloader">
                    github <a href="https://github.com/BlueCitizens/work-manage">https://github.com/BlueCitizens/work-manage</a>
                    <br>
                    by BlueCitizen_dxy
                    <br>
                    theme with Azzara
                    <br>
                </div>
                <div id="ajax-content"></div>
            </div>
        </div>
    </div>
    <!-- End Custom template -->
</div>

<script src="../static/assets/jquery.min.js"></script>
<!--   Core JS Files   -->
<script src="../assets/js/core/popper.min.js"></script>
<script src="../assets/js/core/bootstrap.min.js"></script>

<!-- jQuery UI -->
<script src="../assets/js/plugin/jquery-ui-1.12.1.custom/jquery-ui.min.js"></script>
<script src="../assets/js/plugin/jquery-ui-touch-punch/jquery.ui.touch-punch.min.js"></script>

<!-- jQuery Scrollbar -->
<script src="../assets/js/plugin/jquery-scrollbar/jquery.scrollbar.min.js"></script>

<!-- Moment JS -->
<script src="../assets/js/plugin/moment/moment.min.js"></script>

<!-- Chart JS -->
<script src="../assets/js/plugin/chart.js/chart.min.js"></script>

<!-- jQuery Sparkline -->
<script src="../assets/js/plugin/jquery.sparkline/jquery.sparkline.min.js"></script>

<!-- Chart Circle -->
<script src="../assets/js/plugin/chart-circle/circles.min.js"></script>

<!-- Datatables -->
<script src="../assets/js/plugin/datatables/datatables.min.js"></script>

<!-- Bootstrap Notify -->
<script src="../assets/js/plugin/bootstrap-notify/bootstrap-notify.min.js"></script>

<!-- Bootstrap Toggle -->
<script src="../assets/js/plugin/bootstrap-toggle/bootstrap-toggle.min.js"></script>

<!-- jQuery Vector Maps -->
<script src="../assets/js/plugin/jqvmap/jquery.vmap.min.js"></script>
<script src="../assets/js/plugin/jqvmap/maps/jquery.vmap.world.js"></script>

<!-- Google Maps Plugin -->
<script src="../assets/js/plugin/gmaps/gmaps.js"></script>

<!-- Sweet Alert -->
<script src="../assets/js/plugin/sweetalert/sweetalert.min.js"></script>

<!-- Azzara JS -->
<script src="../assets/js/ready.min.js"></script>
<!-- Azzara DEMO methods, don't include it in your project! -->
<script src="../assets/js/setting-demo.js"></script>
</body>
</html>